﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace VBACodeingTool
{
    public static class RegexManager
    {
        public static Regex publicSubRegex = new Regex("^ *(?:Sub|Function|Public Function|Public Sub) (.+?)\\(", RegexOptions.Multiline|RegexOptions.Compiled);
        public static Regex privateSubRegex = new Regex("^ *(?:Private Function|Private Sub) (.+?)\\(",RegexOptions.Multiline|RegexOptions.Compiled);
        public static Regex publicVariableRegex = new Regex("(?<=^Public )(.+?)(?=\n)", RegexOptions.Multiline|RegexOptions.Compiled);
        public static Regex privateVariableRegex = new Regex("(?<=^Private |Dim )(.+?)(?=\n)", RegexOptions.Multiline|RegexOptions.Compiled);
        public static Regex variableRegex = new Regex("(.+?)(?: As \\w+,{0,1}\\n{0,1}|,|\\n|\\(.{2,3}|\\r)", RegexOptions.Multiline|RegexOptions.Compiled);
        public static Regex replaceSubRegex = new Regex("(?:Public Function|Public Sub|Sub|Function|Private Function|Private Sub) (.+?)(?:End (?:Sub|Function))", RegexOptions.Singleline|RegexOptions.Compiled);
        public static Regex ChineseCountRegex = new Regex(@"\p{IsCJKUnifiedIdeographs}", RegexOptions.Singleline | RegexOptions.Compiled);
        public static Regex EnglishContain = new Regex("[a-zA-Z]",RegexOptions.Singleline | RegexOptions.Compiled);
        public static Regex localVariableRegex = new Regex("^\\s*(?:Dim )(.+)", RegexOptions.Multiline | RegexOptions.Compiled);
    }
}
